app.factory('utilService', function($http) {

    return {

    	ajax: function(params, $scope) {

    		$scope.showLoading = true;
    		$http({
				url: params.url,
				method: params.method || 'get',
				params: params.data || {}
			}).success(function(response) {
				params.ok && params.ok(response);
				$scope.showLoading = false;
			});

    	},

    	fill0: function(num) {
    		return num < 10 ? '0' + num : num;
    	}

    };

});